/*
 * @Author: jiangjinchi 1468922694@qq.com
 * @Date: 2025-10-10 09:16:50
 * @LastEditors: jiangjinchi 1468922694@qq.com
 * @LastEditTime: 2025-10-14 16:07:15
 * @FilePath: \药店大脑PC\src\router\index.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
/*
 * @Author: jiangjinchi 1468922694@qq.com
 * @Date: 2025-10-10 09:16:50
 * @LastEditors: jiangjinchi 1468922694@qq.com
 * @LastEditTime: 2025-10-13 16:39:26
 * @FilePath: \药店大脑PC\src\router\index.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

/**
 * constantRoutes
 * a base page that does not have permission requirements
 * all roles can be accessed
 */
export const constantRoutes = [
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true,
    name: 'login'
  },

  // {
  //   path: '/404',
  //   component: () => import('@/views/404'),
  //   hidden: true
  // },


  {
    name: "运营总览",
    path: "/",
    component: Layout,
    redirect: '/salesData',
    meta: {
      icon: "首页",
      title: "运营总览"
    },
    children: [
      {
        name: "销售数据",
        path: "salesData",
        component: () => import('@/views/dashboard/salesData.vue'),
        meta: {
          title: "销售数据",
          icon: '销售数据_未选中'
        }
      },
      {
        name: "目标跟盯",
        path: "targetTracking",
        component: () => import('@/views/dashboard/targetTracking.vue'),
        meta: {
          title: "目标跟盯",
          icon: '目标跟盯_未选中'

        }
      },
      {
        name: "动销管理",
        path: "dynamicSalesManagement",
        component: () => import('@/views/dashboard/dynamicSalesManagement.vue'),
        meta: {
          title: "动销管理",
          icon: '动销管理_未选中'

        }
      },
      {
        name: "库存管理",
        path: "inventoryManagement",
        component: () => import('@/views/dashboard/inventoryManagement.vue'),
        meta: {
          title: "库存管理",
          icon: '库存管理_未选中'

        }
      },
      {
        name: "会员分析",
        path: "memberAnalysis",
        component: () => import('@/views/dashboard/memberAnalysis.vue'),
        meta: {
          title: "会员分析",
          icon: '会员分析_未选中'


        }
      },
      {
        name: "数据流向",
        path: "dataFlowDirection",
        component: () => import('@/views/dashboard/mainIndex/index.vue'),

        // component: () => import('@/views/dashboard/dataFlowDirection.vue'),
        meta: {
          title: "数据流向",


        },
        children: [
          {
            name: "数据流向",
            path: "dataFlowDirection",
            component: () => import('@/views/dashboard/mainIndex/dataFlowDirection/dataFlowDirection.vue'),
            meta: {
              title: "数据流向",
              icon: '数据流向_未选中'

            }
          },
          {
            name: "入库明细表",
            path: "inventoryDetails",
            component: () => import('@/views/dashboard/mainIndex/inventoryDetails/inventoryDetails.vue'),

            meta: {
              title: "入库明细表",
              icon: '数据流向_未选中'

            }
          },
           {
            name: "库存报表",
            path: "inventoryReport",
            component: () => import('@/views/dashboard/mainIndex/inventoryReport/inventoryReport.vue'),

            meta: {
              title: "库存报表",
              icon: '数据流向_未选中'

            }
          },
            {
            name: "销售数据",
            path: "saleReport",
            component: () => import('@/views/dashboard/mainIndex/saleReport/saleReport.vue'),

            meta: {
              title: "销售数据",
              icon: '数据流向_未选中'

            }
          },
        ]
      },
    ]
  },

  // 404 page must be placed at the end !!!
  // { path: '*', redirect: '/404', hidden: true }
]

const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
